﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="user_add.aspx.cs" Inherits="Web_Admin_User_user_add" %>

<%@ Register src="../ascx/navigation.ascx" tagname="navigation" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理员添加</title>
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../css/default.css" />
    <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../js/jquery.validate.js"></script>
    <script type="text/javascript">
        var id = <%=id %>;
        var reg = /[a-zA-Z0-9]{0,}/;
        //方法
        $.validator.addMethod(
            "username_validate",
            function(value, element) {
                return reg.test($.trim(value));
            },
            "用户名必须为A-Z0-9的字符"
        ); 
        $.validator.addMethod(
            "pwd_validate",
            function(value, element) {
                if(id<1)
                {
                    if($.trim(value)=="")
                    {
                        return false;
                    }
                }
                return true;
            },
            "密码不能为空"
        );   
        $.validator.addMethod(
            "pwd_empty_validate",
            function(value, element) {
                if($.trim(value)!="")
                {
                    return reg.test($.trim(value));
                }
                else
                {
                    return true;
                }
            },
            "密码必须为A-Z0-9的字符"
        );
        $.validator.addMethod(
            "pwd1_validate",
            function(value, element) {
                if(id<1)
                {     
                    if($.trim(value)=="")
                    {
                        return false;
                    }
                }
                
                return true;
            },
            "确认密码不能为空"
        );
        $.validator.addMethod(
            "pwd1_empty_validate",
            function(value, element) {
                if($.trim(value)!="")
                {
                    return reg.test($.trim(value));
                }
                else
                {
                    return true;
                }
            },
            "确认密码必须为A-Z0-9的字符"
        );
        $.validator.addMethod(
            "pwd1_no_validate",
            function(value, element) {
                if(id<1)
                {
                    if($.trim(value)!=$.trim($("#txt_Password").val()))
                    {
                        return false;
                    }
                }
                return true;
            },
            "密码与确认密码不一致"
        );
        
        //验证
        $().ready(function() {
            $("#form1").validate({
                rules: {
                    drpClass: { required: true },
                    txt_UserName: { required: true,username_validate:true },
                    txt_Password: { pwd_validate:true,pwd_empty_validate:true },
                    txt_ComPassword: { pwd1_validate:true,pwd1_empty_validate:true,pwd1_no_validate:true },
                    txt_Age: { required: true,digits:true },
                    txt_Email: { email: true },
                    txt_Integral: { required: true,digits:true }
                },
                messages: {
                    drpClass: { required: "请选择角色类型" },
                    txt_UserName: { required: "用户名不能为空" },
                    txt_Age: { required: "年龄不能为空",digits:"年龄必须为整数" },
                    txt_Email: { email:"邮箱格式不正确" },
                    txt_Integral: { required: "积分不能为空",digits:"积分必须为整数" }
                },
                errorElement: "em",
                errorPlacement: function(error, element) {
                    error.appendTo(element.parent());
                }
            });
        });
    </script>
</head>
<body>
<form id="form1" runat="server">
<uc1:navigation ID="navigation1" Title="会员添加" runat="server" />
<div class="adRbox">
    <div class="arTabBox arFmtd">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <th class="fmth"><asp:Literal ID="lit_title" Text="会员添加" runat="server"></asp:Literal></th>
            <th>&nbsp;</th>
          </tr>
          <tr>
            <td class="addtd">会员类型：</td>
            <td>
                <asp:DropDownList ID="drpUserType" DataTextField="name" DataValueField="id" AppendDataBoundItems="true" runat="server">
                    <asp:ListItem Text="--请选择--" Value=""></asp:ListItem>
                </asp:DropDownList>&nbsp;<em>*</em>&nbsp;
            </td>
          </tr>
          <tr>
            <td class="addtd">用户名：</td>
            <td><asp:TextBox ID="txt_UserName" CssClass="ipt1" runat="server"></asp:TextBox>&nbsp;<em>*</em>&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">密码：</td>
            <td><asp:TextBox ID="txt_Password" TextMode="Password" CssClass="ipt1" runat="server"></asp:TextBox><asp:Literal ID="lit_password" runat="server"></asp:Literal></td>
          </tr>
          <tr>
            <td class="addtd">确认密码：</td>
            <td><asp:TextBox ID="txt_ComPassword" TextMode="Password" CssClass="ipt1" runat="server"></asp:TextBox><asp:Literal ID="lit_compassword" runat="server"></asp:Literal></td>
          </tr>
          <tr>
            <td class="addtd">密码保护问题：</td>
            <td><asp:DropDownList ID="drpQuestion" DataTextField="name" DataValueField="id" AppendDataBoundItems="true" runat="server">
                    <asp:ListItem Text="--请选择--" Value=""></asp:ListItem>
                </asp:DropDownList>&nbsp;<em>*</em>&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">答案：</td>
            <td><asp:TextBox ID="txt_Answer" CssClass="ipt1" runat="server"></asp:TextBox>&nbsp;<em>*</em>&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">昵称：</td>
            <td><asp:TextBox ID="txt_NickName" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">性别：</td>
            <td><asp:RadioButtonList ID="rad_Sex" RepeatLayout="Flow" RepeatColumns="2" runat="server">
                    <asp:ListItem Text="男" Value="1"></asp:ListItem>
                    <asp:ListItem Text="女" Value="2"></asp:ListItem>
                </asp:RadioButtonList>&nbsp;&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">年龄：</td>
            <td><asp:TextBox ID="txt_Age" Text="0" Width="50px" CssClass="ipt1" runat="server"></asp:TextBox>&nbsp;<em>*</em>&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">职位：</td>
            <td><asp:TextBox ID="txt_Occupation" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">QQ：</td>
            <td><asp:TextBox ID="txt_QQ" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">MSN：</td>
            <td><asp:TextBox ID="txt_MSN" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">身高：</td>
            <td><asp:TextBox ID="txt_Height" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">电话：</td>
            <td><asp:TextBox ID="txt_Tel" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">三围：</td>
            <td><asp:TextBox ID="txt_Measurements" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">星座：</td>
            <td><asp:TextBox ID="txt_Constellation" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">签名：</td>
            <td><asp:TextBox ID="txt_Signa" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">家乡：</td>
            <td><asp:TextBox ID="txt_AreaID" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">现居：</td>
            <td><asp:TextBox ID="txt_NowInThe" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">长相如何：</td>
            <td><asp:TextBox ID="txt_Looks" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">恋爱状态：</td>
            <td>
                <asp:DropDownList ID="drpLoveState" runat="server">
                    <asp:ListItem Text="恋爱中" Value="0"></asp:ListItem>
                    <asp:ListItem Text="无恋爱" Value="1"></asp:ListItem>
                </asp:DropDownList>
            </td>
          </tr>
          <tr>
            <td class="addtd">出生年月：</td>
            <td><asp:TextBox ID="txt_Birth" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">学校：</td>
            <td><asp:TextBox ID="txt_School" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">手机型号：</td>
            <td><asp:TextBox ID="txt_PhoneModel" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">身份证号码：</td>
            <td><asp:TextBox ID="txt_CardMumber" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">喜欢的零食：</td>
            <td><asp:TextBox ID="txt_LoveSnacks" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">喜欢的明星：</td>
            <td><asp:TextBox ID="txt_LoveStar" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">喜欢的菜系：</td>
            <td><asp:TextBox ID="txt_LoveCuisines" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">喜欢的电影：</td>
            <td><asp:TextBox ID="txt_LoveMovie" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">暗恋对象：</td>
            <td><asp:TextBox ID="txt_LikeObject" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">恶搞对象：</td>
            <td><asp:TextBox ID="txt_MessObject" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">发泄对象：</td>
            <td><asp:TextBox ID="txt_VentObject" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">喜欢的音乐风格：</td>
            <td><asp:TextBox ID="txt_LoveMusicStyle" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">头像：</td>
            <td><asp:FileUpload ID="txt_HeahImagePath" CssClass="ipt4" runat="server" />&nbsp;&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">积分：</td>
            <td><asp:TextBox ID="txt_Integral" Text="0" Width="50px" CssClass="ipt1" runat="server"></asp:TextBox>&nbsp;<em>*</em>&nbsp;</td>
          </tr>
          <tr>
            <td class="addtd">状态：</td>
            <td><asp:CheckBox ID="chk_IsPass" Text="审核" runat="server" /></td>
          </tr>
          <tr>
            <td class="addtd">添加时间：</td>
            <td><asp:TextBox ID="txt_AddTime" CssClass="ipt1" runat="server"></asp:TextBox></td>
          </tr>
          <tr>
            <td class="addtd">&nbsp;<asp:HiddenField ID="hid_password" runat="server" /></td>
            <td class="fmBtns"><label>
                <asp:Button ID="but_save" runat="server" Text="保存" onclick="but_save_Click" />
                <input type="button" name="button3" id="button3" value="返回" onclick="history.back();" />
            </label></td>
          </tr>
        </table>
    </div>
</div>
</form>
</body>
</html>
